/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tchepannou.rails.siena;

import com.tchepannou.rails.core.bean.AbstractBeanMapper;
import java.lang.reflect.Field;
import siena.Generator;
import siena.Id;

/**
 * Implementation of {@link BeanUtilsBean} for populating active records
 *
 * @author herve
 */
class BeanMapper
    extends AbstractBeanMapper
{
    @Override
    protected boolean isId (Field f)
    {
        return f.getAnnotation (Id.class) != null;
    }

    @Override
    protected boolean isAutogenerated (Field f)
    {
        Id id = f.getAnnotation (Id.class);
        return id != null ? id.value () != Generator.NONE : false;
    }


}
